let app = new Vue({
    el: "#app",
    data: {
        phoneNumber: "",
        checkPhoneOK: false,
        checkPhoneNotOK: false,
        password: "",
        checkPasswordOK: false,
        checkPasswordNotOK: false,
        confirmPassword: "",
        PasswordOK:false,
        PasswordNotOK:false,
    },
    methods: {
        checkPhone: function () {
            // if(this.phoneNumber = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/) this.checkPhoneOK = true;
            // else this.checkPhoneOK = false;
            const reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            if (reg.test(this.phoneNumber)) this.checkPhoneOK = true, this.checkPhoneNotOK = false;
            else this.checkPhoneOK = false, this.checkPhoneNotOK = true;
        },
        checkPassword: function () {
            let reg2 = /^[a-zA-Z]{1}/;
            // if(reg2.test(this.password) && this.password.length >8) this.checkPasswordOK = true;
            // else this.checkPasswordNotOK = true;
            if (this.password.length > 8 && reg2.test(this.password)) {
                this.checkPasswordNotOK = false;
                this.checkPasswordOK = true;
            } else {
                this.checkPasswordOK = false;
                this.checkPasswordNotOK = true;
            }
        },
        checkPasswords: function () {
            if (this.confirmPassword == this.password) {
                this.PasswordOK = true;
                this.PasswordNotOK = false;
            } else {
                this.PasswordOK = false;
                this.PasswordNotOK = true;
            }
        },
        alert:function() {
            if(this.checkPhoneOK == true && this.checkPasswordOK == true && this.PasswordOK == true) {
                window.alert('注册成功！');
            }
            else {
                window.alert('注册失败！请检查手机号和密码格式！');
            }
        }
    }
})